package org.hikari.qqbot.client.message.segment;

import lombok.*;
import org.hikari.qqbot.client.message.IMessageSegmentAdapter;
import org.hikari.qqbot.client.message.MessageSegment;

import java.util.Map;

/**
 * created at 2024-12-23 19:02:57
 *
 * @author yinchao
 * @version 1.0
 **/
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class MarkdownMessageSegment implements IMessageSegmentAdapter {

    public static final String TYPE = "markdown";
    private static final String KEY_CONTENT = "content";

    private String content;

    @Override
    public void fromSegment(MessageSegment segment) {
        this.content = segment.dataValueToString(KEY_CONTENT);
    }

    @Override
    public MessageSegment toSegment() {
        return new MessageSegment(TYPE, Map.of(KEY_CONTENT, content));
    }

}
